FROM crpi-6fc1j1jzo1cwbtgf.cn-chengdu.personal.cr.aliyuncs.com/sirping/php83-fpm-alpine:1.0

# 创建www用户和组
RUN addgroup -g 1000 www && \
    adduser -u 1000 -D -S -G www www && \
    mkdir -p /var/www/.composer/cache && chown -R www:www /var/www  && chmod -R 775 /var/www

ARG INSTALL_SUPERVISOR=false
RUN if [ "$INSTALL_SUPERVISOR" = "true" ]; then \
      apk add --no-cache supervisor=4.2.5-r5;\
    fi

COPY ./docker-entrypoint.sh /usr/local/bin/
RUN dos2unix /usr/local/bin/docker-entrypoint.sh && chmod +x /usr/local/bin/docker-entrypoint.sh

WORKDIR /var/www

# 设置Composer缓存目录
ENV COMPOSER_HOME=/tmp/composer

ENTRYPOINT ["docker-entrypoint.sh"]